home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 25 / AMIGAplus Sonderheft 25 (2000)(Falke)(DE)(Track 1 of 4)[!].iso / Updates / PowerPC / bzip2-0.1pl2 / bzip2.txt < prev    next >
Text File  |  1998-08-03  |  19KB  |  466 lines

  1.  
  2.  
  3.  
  4. bzip2(1)                                                 bzip2(1)
  5.  
  6.  
  7. NAME
  8.        bzip2, bunzip2 - a block-sorting file compressor, v0.1
  9.        bzip2recover - recovers data from damaged bzip2 files
  10.  
  11.  
  12. SYNOPSIS
  13.        bzip2 [ -cdfkstvVL123456789 ] [ filenames ...  ]
  14.        bunzip2 [ -kvsVL ] [ filenames ...  ]
  15.        bzip2recover filename
  16.  
  17.  
  18. DESCRIPTION
  19.        Bzip2  compresses  files  using the Burrows-Wheeler block-
  20.        sorting text compression algorithm,  and  Huffman  coding.
  21.        Compression  is  generally  considerably  better than that
  22.        achieved by more conventional LZ77/LZ78-based compressors,
  23.        and  approaches  the performance of the PPM family of sta-
  24.        tistical compressors.
  25.  
  26.        The command-line options are deliberately very similar  to
  27.        those of GNU Gzip, but they are not identical.
  28.  
  29.        Bzip2  expects  a list of file names to accompany the com-
  30.        mand-line flags.  Each file is replaced  by  a  compressed
  31.        version  of  itself,  with  the  name "original_name.bz2".
  32.        Each compressed file has the same  modification  date  and
  33.        permissions  as  the corresponding original, so that these
  34.        properties can  be  correctly  restored  at  decompression
  35.        time.  File name handling is naive in the sense that there
  36.        is no mechanism for preserving original file  names,  per-
  37.        missions  and  dates  in filesystems which lack these con-
  38.        cepts, or have serious file name length restrictions, such
  39.        as MS-DOS.
  40.  
  41.        Bzip2  and  bunzip2  will not overwrite existing files; if
  42.        you want this to happen, you should delete them first.
  43.  
  44.        If no file names  are  specified,  bzip2  compresses  from
  45.        standard  input  to  standard output.  In this case, bzip2
  46.        will decline to write compressed output to a terminal,  as
  47.        this  would  be  entirely  incomprehensible  and therefore
  48.        pointless.
  49.  
  50.        Bunzip2 (or bzip2 -d ) decompresses and restores all spec-
  51.        ified files whose names end in ".bz2".  Files without this
  52.        suffix are ignored.  Again, supplying no filenames  causes
  53.        decompression from standard input to standard output.
  54.  
  55.        You  can also compress or decompress files to the standard
  56.        output by giving the -c flag.  You can decompress multiple
  57.        files  like  this, but you may only compress a single file
  58.        this way, since it would otherwise be difficult  to  sepa-
  59.        rate  out  the  compressed representations of the original
  60.        files.
  61.  
  62.  
  63.  
  64.                                                                 1
  65.  
  66.  
  67.  
  68.  
  69.  
  70. bzip2(1)                                                 bzip2(1)
  71.  
  72.  
  73.        Compression is always performed, even  if  the  compressed
  74.        file  is slightly larger than the original.  Files of less
  75.        than about one hundred bytes tend to get larger, since the
  76.        compression  mechanism  has  a  constant  overhead  in the
  77.        region of 50 bytes.  Random data (including the output  of
  78.        most  file  compressors)  is  coded at about 8.05 bits per
  79.        byte, giving an expansion of around 0.5%.
  80.  
  81.        As a self-check for your  protection,  bzip2  uses  32-bit
  82.        CRCs  to make sure that the decompressed version of a file
  83.        is identical to the original.  This guards against corrup-
  84.        tion  of  the compressed data, and against undetected bugs
  85.        in bzip2 (hopefully very unlikely).  The chances  of  data
  86.        corruption  going  undetected  is  microscopic,  about one
  87.        chance in four billion for each file processed.  Be aware,
  88.        though,  that  the  check occurs upon decompression, so it
  89.        can only tell you that that something is wrong.  It  can't
  90.        help  you recover the original uncompressed data.  You can
  91.        use bzip2recover to  try  to  recover  data  from  damaged
  92.        files.
  93.  
  94.        Return  values:  0  for a normal exit, 1 for environmental
  95.        problems (file not found, invalid flags, I/O errors,  &c),
  96.        2 to indicate a corrupt compressed file, 3 for an internal
  97.        consistency error (eg, bug) which caused bzip2 to panic.
  98.  
  99.  
  100. MEMORY MANAGEMENT
  101.        Bzip2 compresses large files in blocks.   The  block  size
  102.        affects  both  the  compression  ratio  achieved,  and the
  103.        amount of memory needed both for  compression  and  decom-
  104.        pression.   The flags -1 through -9 specify the block size
  105.        to be 100,000 bytes through 900,000  bytes  (the  default)
  106.        respectively.   At decompression-time, the block size used
  107.        for compression is read from the header of the  compressed
  108.        file, and bunzip2 then allocates itself just enough memory
  109.        to decompress the file.  Since block sizes are  stored  in
  110.        compressed  files,  it follows that the flags -1 to -9 are
  111.        irrelevant to and so ignored during  decompression.   Com-
  112.        pression  and decompression requirements, in bytes, can be
  113.        estimated as:
  114.  
  115.              Compression:   400k + ( 7 x block size )
  116.  
  117.              Decompression: 100k + ( 5 x block size ), or
  118.                             100k + ( 2.5 x block size )
  119.  
  120.        Larger  block  sizes  give  rapidly  diminishing  marginal
  121.        returns;  most of the compression comes from the first two
  122.        or three hundred k of block size, a fact worth bearing  in
  123.        mind  when  using  bzip2  on  small  machines.  It is also
  124.        important to  appreciate  that  the  decompression  memory
  125.        requirement  is  set  at compression-time by the choice of
  126.        block size.
  127.  
  128.  
  129.  
  130.                                                                 2
  131.  
  132.  
  133.  
  134.  
  135.  
  136. bzip2(1)                                                 bzip2(1)
  137.  
  138.  
  139.        For files compressed with the  default  900k  block  size,
  140.        bunzip2  will require about 4600 kbytes to decompress.  To
  141.        support decompression of any file on a 4 megabyte machine,
  142.        bunzip2  has  an  option to decompress using approximately
  143.        half this amount of memory, about 2300 kbytes.  Decompres-
  144.        sion  speed  is also halved, so you should use this option
  145.        only where necessary.  The relevant flag is -s.
  146.  
  147.        In general, try and use the largest block size memory con-
  148.        straints  allow,  since  that  maximises  the  compression
  149.        achieved.  Compression and decompression speed are  virtu-
  150.        ally unaffected by block size.
  151.  
  152.        Another  significant point applies to files which fit in a
  153.        single block -- that  means  most  files  you'd  encounter
  154.        using  a  large  block  size.   The  amount of real memory
  155.        touched is proportional to the size of the file, since the
  156.        file  is smaller than a block.  For example, compressing a
  157.        file 20,000 bytes long with the flag  -9  will  cause  the
  158.        compressor  to  allocate  around 6700k of memory, but only
  159.        touch 400k + 20000 * 7 = 540 kbytes of it.  Similarly, the
  160.        decompressor  will  allocate  4600k  but only touch 100k +
  161.        20000 * 5 = 200 kbytes.
  162.  
  163.        Here is a table which summarises the maximum memory  usage
  164.        for  different  block  sizes.   Also recorded is the total
  165.        compressed size for 14 files of the Calgary Text  Compres-
  166.        sion  Corpus totalling 3,141,622 bytes.  This column gives
  167.        some feel for how  compression  varies  with  block  size.
  168.        These  figures  tend to understate the advantage of larger
  169.        block sizes for larger files, since the  Corpus  is  domi-
  170.        nated by smaller files.
  171.  
  172.                   Compress   Decompress   Decompress   Corpus
  173.            Flag     usage      usage       -s usage     Size
  174.  
  175.             -1      1100k       600k         350k      914704
  176.             -2      1800k      1100k         600k      877703
  177.             -3      2500k      1600k         850k      860338
  178.             -4      3200k      2100k        1100k      846899
  179.             -5      3900k      2600k        1350k      845160
  180.             -6      4600k      3100k        1600k      838626
  181.             -7      5400k      3600k        1850k      834096
  182.             -8      6000k      4100k        2100k      828642
  183.             -9      6700k      4600k        2350k      828642
  184.  
  185.  
  186. OPTIONS
  187.        -c